package controleur;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import model.Cours;
import businessObjects.CoursBo;
import businessObjects.EtudiantBo;

public class ChronologieCoursAction extends Action{
	
	Cours unCours = new Cours();
	CoursBo unCoursBo = new CoursBo();
	EtudiantBo unEtudiantBo = new EtudiantBo();
	
	public ActionForward execute(ActionMapping mapping, 
			ActionForm form, 
			HttpServletRequest req, 
			HttpServletResponse res) throws Exception {
		String resultat = null;

		String idCours= req.getParameter("idCours");
		int id=Integer.parseInt(idCours);
		
		req.setAttribute("cours",unCoursBo.getCours(id));
		req.setAttribute("etudiant",unEtudiantBo.getProfile(id));
		
		if (idCours!=null){	
			resultat = "succes";
		} else {
			resultat = "echec";
		}
		return mapping.findForward(resultat);
	}
}
